// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
use crate::Result;

/// Implements a [LoggingServiceV2](super::stub::LoggingServiceV2) decorator for logging and tracing.
#[derive(Clone, Debug)]
pub struct LoggingServiceV2<T>
where
    T: super::stub::LoggingServiceV2 + std::fmt::Debug + Send + Sync,
{
    inner: T,
}

impl<T> LoggingServiceV2<T>
where
    T: super::stub::LoggingServiceV2 + std::fmt::Debug + Send + Sync,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}

impl<T> super::stub::LoggingServiceV2 for LoggingServiceV2<T>
where
    T: super::stub::LoggingServiceV2 + std::fmt::Debug + Send + Sync,
{
    #[tracing::instrument(ret)]
    async fn delete_log(
        &self,
        req: crate::model::DeleteLogRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_log(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn write_log_entries(
        &self,
        req: crate::model::WriteLogEntriesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::WriteLogEntriesResponse>> {
        self.inner.write_log_entries(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_log_entries(
        &self,
        req: crate::model::ListLogEntriesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListLogEntriesResponse>> {
        self.inner.list_log_entries(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_monitored_resource_descriptors(
        &self,
        req: crate::model::ListMonitoredResourceDescriptorsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListMonitoredResourceDescriptorsResponse>>
    {
        self.inner
            .list_monitored_resource_descriptors(req, options)
            .await
    }

    #[tracing::instrument(ret)]
    async fn list_logs(
        &self,
        req: crate::model::ListLogsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListLogsResponse>> {
        self.inner.list_logs(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_operations(
        &self,
        req: longrunning::model::ListOperationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::ListOperationsResponse>> {
        self.inner.list_operations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_operation(
        &self,
        req: longrunning::model::GetOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.get_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn cancel_operation(
        &self,
        req: longrunning::model::CancelOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.cancel_operation(req, options).await
    }
}

/// Implements a [ConfigServiceV2](super::stub::ConfigServiceV2) decorator for logging and tracing.
#[derive(Clone, Debug)]
pub struct ConfigServiceV2<T>
where
    T: super::stub::ConfigServiceV2 + std::fmt::Debug + Send + Sync,
{
    inner: T,
}

impl<T> ConfigServiceV2<T>
where
    T: super::stub::ConfigServiceV2 + std::fmt::Debug + Send + Sync,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}

impl<T> super::stub::ConfigServiceV2 for ConfigServiceV2<T>
where
    T: super::stub::ConfigServiceV2 + std::fmt::Debug + Send + Sync,
{
    #[tracing::instrument(ret)]
    async fn list_buckets(
        &self,
        req: crate::model::ListBucketsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListBucketsResponse>> {
        self.inner.list_buckets(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_bucket(
        &self,
        req: crate::model::GetBucketRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogBucket>> {
        self.inner.get_bucket(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_bucket_async(
        &self,
        req: crate::model::CreateBucketRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_bucket_async(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_bucket_async(
        &self,
        req: crate::model::UpdateBucketRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_bucket_async(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_bucket(
        &self,
        req: crate::model::CreateBucketRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogBucket>> {
        self.inner.create_bucket(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_bucket(
        &self,
        req: crate::model::UpdateBucketRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogBucket>> {
        self.inner.update_bucket(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_bucket(
        &self,
        req: crate::model::DeleteBucketRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_bucket(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn undelete_bucket(
        &self,
        req: crate::model::UndeleteBucketRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.undelete_bucket(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_views(
        &self,
        req: crate::model::ListViewsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListViewsResponse>> {
        self.inner.list_views(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_view(
        &self,
        req: crate::model::GetViewRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogView>> {
        self.inner.get_view(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_view(
        &self,
        req: crate::model::CreateViewRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogView>> {
        self.inner.create_view(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_view(
        &self,
        req: crate::model::UpdateViewRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogView>> {
        self.inner.update_view(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_view(
        &self,
        req: crate::model::DeleteViewRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_view(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_sinks(
        &self,
        req: crate::model::ListSinksRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListSinksResponse>> {
        self.inner.list_sinks(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_sink(
        &self,
        req: crate::model::GetSinkRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogSink>> {
        self.inner.get_sink(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_sink(
        &self,
        req: crate::model::CreateSinkRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogSink>> {
        self.inner.create_sink(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_sink(
        &self,
        req: crate::model::UpdateSinkRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogSink>> {
        self.inner.update_sink(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_sink(
        &self,
        req: crate::model::DeleteSinkRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_sink(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_link(
        &self,
        req: crate::model::CreateLinkRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_link(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_link(
        &self,
        req: crate::model::DeleteLinkRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_link(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_links(
        &self,
        req: crate::model::ListLinksRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListLinksResponse>> {
        self.inner.list_links(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_link(
        &self,
        req: crate::model::GetLinkRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Link>> {
        self.inner.get_link(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_exclusions(
        &self,
        req: crate::model::ListExclusionsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListExclusionsResponse>> {
        self.inner.list_exclusions(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_exclusion(
        &self,
        req: crate::model::GetExclusionRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogExclusion>> {
        self.inner.get_exclusion(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_exclusion(
        &self,
        req: crate::model::CreateExclusionRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogExclusion>> {
        self.inner.create_exclusion(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_exclusion(
        &self,
        req: crate::model::UpdateExclusionRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogExclusion>> {
        self.inner.update_exclusion(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_exclusion(
        &self,
        req: crate::model::DeleteExclusionRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_exclusion(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_cmek_settings(
        &self,
        req: crate::model::GetCmekSettingsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::CmekSettings>> {
        self.inner.get_cmek_settings(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_cmek_settings(
        &self,
        req: crate::model::UpdateCmekSettingsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::CmekSettings>> {
        self.inner.update_cmek_settings(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_settings(
        &self,
        req: crate::model::GetSettingsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Settings>> {
        self.inner.get_settings(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_settings(
        &self,
        req: crate::model::UpdateSettingsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Settings>> {
        self.inner.update_settings(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn copy_log_entries(
        &self,
        req: crate::model::CopyLogEntriesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.copy_log_entries(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_operations(
        &self,
        req: longrunning::model::ListOperationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::ListOperationsResponse>> {
        self.inner.list_operations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_operation(
        &self,
        req: longrunning::model::GetOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.get_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn cancel_operation(
        &self,
        req: longrunning::model::CancelOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.cancel_operation(req, options).await
    }

    fn get_polling_error_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
        self.inner.get_polling_error_policy(options)
    }

    fn get_polling_backoff_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
        self.inner.get_polling_backoff_policy(options)
    }
}

/// Implements a [MetricsServiceV2](super::stub::MetricsServiceV2) decorator for logging and tracing.
#[derive(Clone, Debug)]
pub struct MetricsServiceV2<T>
where
    T: super::stub::MetricsServiceV2 + std::fmt::Debug + Send + Sync,
{
    inner: T,
}

impl<T> MetricsServiceV2<T>
where
    T: super::stub::MetricsServiceV2 + std::fmt::Debug + Send + Sync,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}

impl<T> super::stub::MetricsServiceV2 for MetricsServiceV2<T>
where
    T: super::stub::MetricsServiceV2 + std::fmt::Debug + Send + Sync,
{
    #[tracing::instrument(ret)]
    async fn list_log_metrics(
        &self,
        req: crate::model::ListLogMetricsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListLogMetricsResponse>> {
        self.inner.list_log_metrics(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_log_metric(
        &self,
        req: crate::model::GetLogMetricRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogMetric>> {
        self.inner.get_log_metric(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_log_metric(
        &self,
        req: crate::model::CreateLogMetricRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogMetric>> {
        self.inner.create_log_metric(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_log_metric(
        &self,
        req: crate::model::UpdateLogMetricRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LogMetric>> {
        self.inner.update_log_metric(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_log_metric(
        &self,
        req: crate::model::DeleteLogMetricRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_log_metric(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_operations(
        &self,
        req: longrunning::model::ListOperationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::ListOperationsResponse>> {
        self.inner.list_operations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_operation(
        &self,
        req: longrunning::model::GetOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.get_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn cancel_operation(
        &self,
        req: longrunning::model::CancelOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.cancel_operation(req, options).await
    }
}
